﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Business_Add.aspx.cs" Inherits="Business_Business_Add" MasterPageFile="../MasterPage.master" %>

<%@ Import Namespace="Common" %>
<%@ Register src="Business_Left.ascx" tagname="Business_Left" tagprefix="uc1" %>

<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
    <script type="text/javascript">
        function clsid(source, args) {
            var isselect = false;

            var chkliststr = document.getElementById("<%= ClsID.ClientID %>");
            var chklist = chkliststr.getElementsByTagName('input'); 

            for (var i = 0; i < chklist.length; i++) {
                if (chklist[i].checked)
                    isselect = true;
            }

            if (isselect)
            { args.IsValid = true; }
            else
            { args.IsValid = false; }
        }
        function CV(source, args) {

            var date1 = document.getElementById('<%= TechOneD.ClientID %>');
            var date2 = document.getElementById('<%= TechTwoD.ClientID %>');

            var h1 = document.getElementById('<%= TechOneT_H.ClientID %>');
            var h2 = document.getElementById('<%= TechTwoT_H.ClientID %>');
            
            var m1 = document.getElementById('<%= TechOneT_M.ClientID %>');
            var m2 = document.getElementById('<%= TechTwoT_M.ClientID %>');

            var t1 = new Date(date1.value.replace(/-/g, "/") + ' ' + h1.value + ':' + m1.value + ':00');
            var t2 = new Date(date2.value.replace(/-/g, "/") + ' ' + h2.value + ':' + m2.value + ':00');

            if (t1 >= t2)
            {  args.IsValid = false; }
            else
            {  args.IsValid = true; }
        }
    </script>
    <script type="text/javascript">
        //下限日期默认选中
        function setDefaultDate(obj) {
            if (obj.value != "") {
                document.getElementById("<%= TechTwoD.ClientID %>").value = obj.value;
            }
        }
        function SetT(obj, clientid) {
            
            document.getElementById(clientid).value = obj.value;
        }
        //下限时间默认选中(时间相同,分钟+30)
        function SetT1(obj, clientid) {

            document.getElementById(clientid).value = obj.value;

            if (obj.value != "") {
                var add_time = Add30M(document.getElementById('<%= TechOneT_H.ClientID %>').value, document.getElementById('<%= TechOneT_M.ClientID %>').value);
                if (add_time != "") {
                    document.getElementById('<%= TechTwoT_H.ClientID %>').value = getH(add_time.split(":")[0]);
                    document.getElementById('<%= TechTwoT_M.ClientID %>').value = getM(add_time.split(":")[1]);
                }
            }
        }
    </script>
     <table cellpadding="0" cellspacing="2" width="100%" border="0">
	<tr>
        <td class="leftTd"  valign="top" width="20%">
        <uc1:Business_Left ID="Business_Left1" runat="server" />
        </td>
		<td width="85%" valign="top">
		<table cellpadding="0" cellspacing="0" width="100%" border="0" align="center">
			<tr>
		        <td class="leftTd"  valign="top">
		        <table cellpadding="0" cellspacing="0" width="100%" border="0" align="center">
		        	<tr>
		            	<td class="titleStyle"><%= WebUtility.GetTitleByMenu(MenuType) %></td>
		            </tr>
		        </table>
		        <br />
		        <table cellpadding="0" cellspacing="1" width="100%" border="0" style="background:#000066;">
	                <form method="post" action="" name="AddForm" onSubmit="return CheckAddNew()">
	                 <input type="hidden" name="Oper" value="AddNews"> 
	                    <tr>
	                        <td class="leftContent">任务类型：</td>
	                        <td class="RightContent">
                                <asp:CheckBoxList ID="ClsID" runat="server" RepeatDirection="Horizontal" 
                                    AutoPostBack="true" onselectedindexchanged="ClsID_SelectedIndexChanged">
                                </asp:CheckBoxList>
	                                     <asp:Label ID="Msg" runat="server" ForeColor="Red"></asp:Label>
                                     <asp:CustomValidator ID="CustomValidator3" runat="server" 
                                    ClientValidationFunction="clsid" 
                                    ErrorMessage="请选择任务类型" ValidateEmptyText="True"></asp:CustomValidator>
                                        <asp:Panel ID="P_Quote" runat="server" Visible="false">
                                           <table>
                                              <tr>
                                                 <td align="right">物品：</td>
                                                 <td><asp:TextBox ID="Quote_StockName" runat="server"></asp:TextBox>
                                                 <asp:HiddenField ID="Quote_StockType" runat="server" />
                                                 <asp:HiddenField ID="Quote_StockID" runat="server" />
                                               请选择：<a class="thickbox" href="../Stock/SelectStock.aspx?ParentID=<%= Quote_StockName.ClientID %>&ParentID1=<%= Quote_StockID.ClientID %>&KeepThis=true&TB_iframe=true&height=550&width=800" onclick="$('#' + '<%= Quote_StockType.ClientID %>').val('库存物品');">库存物品</a> /
                                               <a class="thickbox" href="../Stock/SelectWxStock.aspx?ParentID=<%= Quote_StockName.ClientID %>&ParentID1=<%= Quote_StockID.ClientID %>&KeepThis=true&TB_iframe=true&height=550&width=800" onclick="$('#' + '<%= Quote_StockType.ClientID %>').val('报修入库物品');" >报修入库物品</a>
                                                     <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" ErrorMessage="请选择物品" ControlToValidate="Quote_StockName"></asp:RequiredFieldValidator></td>
                                               </td>
                                              </tr>
                                              <tr>
                                                 <td align="right">报价：</td>
                                                 <td><asp:DropDownList ID="Quote_IsQuote" runat="server" AutoPostBack="True" 
                                                         onselectedindexchanged="Quote_IsQuote_SelectedIndexChanged">
                                                     <asp:ListItem Value="未报价" Selected="True">未报价</asp:ListItem>
                                                     <asp:ListItem Value="已报价">已报价</asp:ListItem>
                                                    </asp:DropDownList></td>
                                              </tr>
                                              <tr>
                                                 <td align="right"><asp:Label ID="LB_Quote_Price" runat="server" Text="价格：" Visible="false"></asp:Label></td>
                                                 <td><asp:TextBox ID="Quote_Price" runat="server" Width="60px" Visible="false"></asp:TextBox></td>
                                              </tr>
                                           </table>
                                        </asp:Panel>
                                        <asp:Panel ID="P_Fetch" runat="server" Visible="false">
                                           <table>
                                              <tr>
                                                 <td align="right">送/取内容：</td>
                                                 <td><asp:TextBox ID="Fetch_FetchName" runat="server"></asp:TextBox>
                                                 <asp:HiddenField ID="Fetch_FetchType" runat="server" />
                                                 <asp:HiddenField ID="Fetch_FetchID" runat="server" />
                                               请选择：<a class="thickbox" href="../Stock/SelectInvoice.aspx?ParentID=<%= Fetch_FetchName.ClientID %>&ParentID1=<%= Fetch_FetchID.ClientID %>&KeepThis=true&TB_iframe=true&height=550&width=800" onclick="$('#' + '<%= Fetch_FetchType.ClientID %>').val('发票');">发票</a> /
                                               <a class="thickbox" href="../Stock/SelectWxStock1.aspx?ParentID=<%= Fetch_FetchName.ClientID %>&ParentID1=<%= Fetch_FetchID.ClientID %>&KeepThis=true&TB_iframe=true&height=550&width=800" onclick="$('#' + '<%= Fetch_FetchType.ClientID %>').val('报修出库物品');" >报修出库物品</a>
                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" ErrorMessage="请选择送取内容" ControlToValidate="Fetch_FetchName"></asp:RequiredFieldValidator></td>
                                               </td>
                                              </tr>
                                               <tr>
                                                 <td align="right">报价单号：</td>
                                                 <td><asp:TextBox ID="Fetch_DanNum" runat="server" Width="80px" ></asp:TextBox>
                                                 请选择：<a class="thickbox" href="../Business/SelectDanNum.aspx?ParentID=<%= Fetch_DanNum.ClientID %>&ClsIDType=6&KeepThis=true&TB_iframe=true&height=550&width=800" >预约序号(报价)</a>
                                                 </td>
                                              </tr>
                                            </table>
                                        </asp:Panel>
	                      </td>
	                    </tr>
	                   <%-- <tr>
	                        <td class="leftContent">预约标题：</td>
	                        <td class="RightContent">
	                        <asp:TextBox ID="Topic" runat="server" Width="150" class="face"></asp:TextBox>
	                        </td>
	                    </tr>--%>
	                    <tr>
	                        <td class="leftContent" valign="top" style="padding-top:5px; height: 55px;">预约描述：</td>
	                        <td class="RightContent" style="height: 115px"><textarea name="Content_Cus" style="display: none"></textarea><asp:TextBox 
                                    ID="Content_Cus" runat="server" Width="322px" class="face" Height="98px" 
                                    TextMode="MultiLine"></asp:TextBox>
	                        </td>
	                    </tr>
		                <tr id="TR_MUserKey" runat="server">
		                    <td class="leftContent">预约人员：</td>
		                    <td class="RightContent">
		                      <asp:DropDownList ID="MUserKey" runat="server" CssClass="face">
		                        <asp:ListItem Value="0" Selected="True">请选择预约任务相关人员</asp:ListItem>
		                      </asp:DropDownList>
		                    </td>
		                </tr>
	                    <tr>
	                        <td class="leftContent">预约上限时间：</td>
	                        <td class="RightContent">
                            日期:<asp:TextBox ID="TechOneD" runat="server" Width="70px" CssClass="face" ></asp:TextBox>&nbsp;
                            小时:<asp:TextBox ID="TechOneT_H" runat="server" Width="18px" CssClass="face"></asp:TextBox>
                                 <select id="TechOneT_H_sel" style="margin-left:-25px; position:absolute; clip:rect(auto 38px auto 22px);" onchange="SetT(this,'<%=TechOneT_H.ClientID  %>');">
                                    <option value=""></option>
                                    <option value="06">06</option>
                                    <option value="07">07</option>
                                    <option value="08">08</option>
                                    <option value="09">09</option>
                                    <option value="10">10</option>
                                    <option value="11">11</option>
                                    <option value="12">12</option>
                                    <option value="13">13</option>
                                    <option value="14">14</option>
                                    <option value="15">15</option>
                                    <option value="16">16</option>
                                    <option value="17">17</option>
                                    <option value="18">18</option>
                                    <option value="19">19</option>
                                    <option value="20">20</option>
                                    <option value="21">21</option>
                                    <option value="22">22</option>
                                 </select>
                            &nbsp;&nbsp;&nbsp;&nbsp;分钟:<asp:TextBox ID="TechOneT_M" runat="server" Width="18px" CssClass="face"></asp:TextBox>
	                        <select id="TechOneT_M_sel" style="margin-left:-25px; position:absolute; clip:rect(auto 38px auto 22px);" onchange="SetT1(this,'<%=TechOneT_M.ClientID  %>');">
	                                <option value=""></option>
                                    <option value="00">00</option>
                                    <option value="05">05</option>
                                    <option value="10">10</option>
                                    <option value="15">15</option>
                                    <option value="20">20</option>
                                    <option value="25">25</option>
                                    <option value="30">30</option>
                                    <option value="35">35</option>
                                    <option value="40">40</option>
                                    <option value="45">45</option>
                                    <option value="50">50</option>
                                    <option value="55">55</option>
                                 </select>
	                        &nbsp;&nbsp;&nbsp;&nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator3" 
                                    runat="server" ControlToValidate="TechOneD" Display="Dynamic" 
                                    ErrorMessage="请选择上限日期"></asp:RequiredFieldValidator>
                                     <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                                    ControlToValidate="TechOneT_H" Display="Dynamic" ErrorMessage="请选择下限小时"></asp:RequiredFieldValidator>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                                    ControlToValidate="TechOneT_M" Display="Dynamic" ErrorMessage="请选择下限分钟"></asp:RequiredFieldValidator>
                            </td>
	                    </tr>
	                    <tr>
	                        <td class="leftContent">预约下限时间：</td>
	                        <td class="RightContent">
	                        日期:<asp:TextBox ID="TechTwoD" runat="server" Width="70px" CssClass="face"></asp:TextBox>&nbsp;
	                        小时:<asp:TextBox ID="TechTwoT_H" runat="server" Width="18px" CssClass="face"></asp:TextBox>
	                             <select id="TechTwoT_H_sel" style="margin-left:-25px; position:absolute; clip:rect(auto 38px auto 22px);" onchange="SetT(this,'<%=TechTwoT_H.ClientID  %>');">
	                                <option value=""></option>
                                    <option value="06">06</option>
                                    <option value="07">07</option>
                                    <option value="08">08</option>
                                    <option value="09">09</option>
                                    <option value="10">10</option>
                                    <option value="11">11</option>
                                    <option value="12">12</option>
                                    <option value="13">13</option>
                                    <option value="14">14</option>
                                    <option value="15">15</option>
                                    <option value="16">16</option>
                                    <option value="17">17</option>
                                    <option value="18">18</option>
                                    <option value="19">19</option>
                                    <option value="20">20</option>
                                    <option value="21">21</option>
                                    <option value="22">22</option>
                                 </select>
                                 &nbsp;&nbsp;&nbsp;&nbsp;分钟:<asp:TextBox ID="TechTwoT_M" runat="server" Width="18px" CssClass="face"></asp:TextBox>
                                <select id="TechTwoT_M_sel" style="margin-left:-25px; position:absolute; clip:rect(auto 38px auto 22px);" onchange="SetT(this,'<%=TechTwoT_M.ClientID  %>');">
                                        <option value=""></option>
                                        <option value="00">00</option>
                                        <option value="05">05</option>
                                        <option value="10">10</option>
                                        <option value="15">15</option>
                                        <option value="20">20</option>
                                        <option value="25">25</option>
                                        <option value="30">30</option>
                                        <option value="35">35</option>
                                        <option value="40">40</option>
                                        <option value="45">45</option>
                                        <option value="50">50</option>
                                        <option value="55">55</option>
                                 </select>
	                        &nbsp;&nbsp;&nbsp;
	                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                    ControlToValidate="TechTwoD" Display="Dynamic" ErrorMessage="请选择下限日期"></asp:RequiredFieldValidator>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                                    ControlToValidate="TechTwoT_H" Display="Dynamic" ErrorMessage="请选择下限小时"></asp:RequiredFieldValidator>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                                    ControlToValidate="TechTwoT_M" Display="Dynamic" ErrorMessage="请选择下限分钟"></asp:RequiredFieldValidator>
                                <asp:CustomValidator ID="CustomValidator1" runat="server" 
                                    ClientValidationFunction="CV" ControlToValidate="TechTwoT_M" 
                                    ErrorMessage="上限时间必须小于下限时间" ValidateEmptyText="True"></asp:CustomValidator>
	                        </td>
	                    </tr>
	                    <tr>
	                        <td class="leftContent">公司名称：</td>
	                        <td class="RightContent">
	                        <asp:TextBox ID="UserCompany" runat="server" Width="150" class="face"></asp:TextBox>
	                        </td>
	                    </tr>
	                    <tr>
	                        <td class="leftContent">报修人姓名：</td>
	                        <td class="RightContent">
	                        <asp:TextBox ID="UserName" runat="server" Width="150" class="face"></asp:TextBox>
                            <a style="display:<%= UserType==1?"none":"" %>;" class="thickbox" href="../Business/SelectUser.aspx?ParentID1=<%= UserCompany.ClientID %>&ParentID2=<%= UserName.ClientID %>&ParentID3=<%= UserNameTEL.ClientID %>&ParentID4=<%= UserID.ClientID %>&KeepThis=true&TB_iframe=true&height=550&width=800" >选择联系人</a>
                            <asp:HiddenField ID="UserID" runat="server" />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ErrorMessage="请选择联系人" ControlToValidate="UserCompany" ></asp:RequiredFieldValidator></td>
	                    </tr>
	                    <tr>
	                        <td class="leftContent">报修人联系方式：</td><td class="RightContent">
	                        <asp:TextBox ID="UserNameTEL" runat="server" Width="150" class="face"></asp:TextBox></td></tr><tr>
	                        <td class="leftContent" valign="top" style="padding-top:20px;height:30px;"></td>
	                        <td class="RightContent">
                            <asp:Button ID="btnSubmit" runat="server" Text="添 加" CssClass="button" 
                                    onclick="btnSubmit_Click" />
	                        &nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="重 置" name="btnReset" class="button"></td></tr></form></table></td></tr></table></td></tr></table></asp:Content>